﻿<%@ Page Title="" Language="C#" MasterPageFile="~/UI/Administrator/Dashboard.Master"
    AutoEventWireup="true" CodeBehind="AccountManagement.aspx.cs" Inherits="OnlineRailway.Administrator.AccountManagement" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="stylesheet" type="text/css" href="../../Style/MainContent.css" />
    <script type="text/javascript">
        function ConfirmationBox(username) {
            var result = confirm('Are you sure you want to delete "' + username + '" account?');
            if (result) {
                return true;
            }
            else {
                return false;
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentMain" runat="server">
    <div id="main">
        <div id="form">
            <div id="header">
                <p>
                    Accounts manager</p>
                <asp:Button runat="server" ID="btnAccNew" Text="Create account" CssClass="btnNav btnNavTop"
                    PostBackUrl="~/UI/Administrator/AccountAdd.aspx" />
            </div>
            <div id="form-content">
                <div class="lblError">
                    <asp:Label runat="server" ID="lblMessage"></asp:Label></div>
                <div id="div-GridView">
                    <asp:GridView runat="server" ID="gvAccount" AutoGenerateColumns="False" DataKeyNames="AccountID,UserName"
                        CssClass="gv" CellPadding="4" GridLines="None" ForeColor="#333333" OnRowCancelingEdit="gvAccount_RowCancelingEdit"
                        OnRowEditing="gvAccount_RowEditing" OnRowDeleting="gvAccount_RowDeleting" OnRowUpdating="gvAccount_RowUpdating"
                        OnRowDataBound="gvAccount_RowDataBound">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField HeaderText="ID">
                                <ItemTemplate>
                                    <%# Eval("AccountID")%></ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label runat="server" ID="lblID" Text='<%# Eval("AccountID")%>'></asp:Label></EditItemTemplate>
                               </asp:TemplateField>
                            <asp:TemplateField HeaderText="UserName">
                                <ItemTemplate>
                                    <%# Eval("UserName")%></ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label runat="server" ID="lblUserName" Text='<%# Bind("UserName") %>'></asp:Label></EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="FullName">
                                <ItemTemplate>
                                    <%# Eval("FullName")%></ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server" ID="txtFullNameEdit" Text='<%# Bind("FullName") %>'></asp:TextBox></EditItemTemplate>
                                
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Age">
                                <ItemTemplate>
                                    <%# Eval("Age")%></ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server" ID="txtAgeEdit" Text="<%# Bind('Age') %>"></asp:TextBox></EditItemTemplate>
                                </asp:TemplateField>
                            <asp:TemplateField HeaderText="Gender">
                                <ItemTemplate>
                                    <asp:DropDownList runat="server" ID="ddlGender" SelectedValue='<%# Eval("Gender") %>'
                                        Enabled="False">
                                        <asp:ListItem>Male</asp:ListItem>
                                        <asp:ListItem>Female</asp:ListItem>
                                    </asp:DropDownList>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList runat="server" ID="ddlGenderEdit" SelectedValue='<%# Bind("Gender") %>'
                                                      Enabled="True">
                                        <asp:ListItem>Male</asp:ListItem>
                                        <asp:ListItem>Female</asp:ListItem>
                                    </asp:DropDownList>
                                </EditItemTemplate>
                                
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Address">
                                <ItemTemplate>
                                    <%# Eval("Address")%></ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server"  ID="txtAddressEdit" Text="<%# Bind('Address') %>"></asp:TextBox></EditItemTemplate>
                                
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Telephone" >
                                <ItemTemplate>
                                    <%# Eval("Telephone")%></ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server" ID="txtTelephoneEdit" Text="<%# Bind('Telephone') %>"></asp:TextBox></EditItemTemplate>
                               
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Email">
                                <ItemTemplate>
                                    <%# Eval("Email")%></ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server"  ID="txtEmailEdit" Text='<%# Bind("Email") %>'></asp:TextBox></EditItemTemplate>
                                
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Images">
                                <ItemTemplate>
                                    <asp:Image runat="server" ID="imgImage" ImageUrl='<%# Eval("Images")%>' Width="120px"
                                        Height="120px" />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:FileUpload runat="server" ID="fuImageEdit" />
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Qualification">
                                <ItemTemplate>
                                    <%# Eval("Qualification")%></ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox runat="server" ID="txtQualificationEdit" Text='<%# Bind("Qualification") %>'></asp:TextBox></EditItemTemplate>
                                
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Role" ItemStyle-HorizontalAlign="Left">
                                <ItemTemplate>
                                    <asp:DropDownList runat="server" ID="ddlRole" 
                                        SelectedValue='<%# (Roles2)Eval("[Role]") %>' Enabled="False">
                                        <asp:ListItem>Admin</asp:ListItem>
                                        <asp:ListItem>Staff</asp:ListItem>
                                        <asp:ListItem>Customer</asp:ListItem>
                                    </asp:DropDownList>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList runat="server" ID="ddlRoleEdit" SelectedValue='<%# (Roles2)Eval("[Role]") %>' Enabled="True">
                                        <asp:ListItem>Admin</asp:ListItem>
                                        <asp:ListItem>Staff</asp:ListItem>
                                        <asp:ListItem>Customer</asp:ListItem>
                                    </asp:DropDownList>
                                </EditItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Action">
                                <ItemTemplate>
                                    <asp:ImageButton runat="server" ID="ibtnEdit" ToolTip="Edit" CommandName="Edit" ImageUrl="../../StorageImage/icon-edit.png"
                                        ImageAlign="Baseline" Width="24px" Height="24px" />
                                    <asp:ImageButton runat="server" ID="ibtnDelete" ToolTip="Delete" CommandName="Delete"
                                        ImageUrl="../../StorageImage/icon-delete.png" ImageAlign="Baseline" Width="24px"
                                        Height="24px" />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:ImageButton runat="server" ID="ibtnUpdate" ToolTip="Update" CommandName="Update"
                                        ImageUrl="../../StorageImage/icon-update.png" ImageAlign="Baseline" Width="24px"
                                        Height="24px" />
                                    <asp:ImageButton runat="server" ID="ibtnCancel" ToolTip="Cancel" CommandName="Cancel"
                                        ImageUrl="../../StorageImage/icon-cancel.png" ImageAlign="Baseline" Width="24px"
                                        Height="24px" />
                                    <itemstyle width="50px"></itemstyle>
                                </EditItemTemplate>

<ItemStyle Width="50px"></ItemStyle>
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" ForeColor="#333333" Font-Bold="True" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
